<?php 
define('BASEPATH', true);
include('inc/config.php');

if(isset($_GET['cod']) && $_GET['cod'] != 0){
	$cod = $db->EscapeString($_GET['cod']);
	
	$sql = $db->Query("SELECT * FROM `users` WHERE `activate`='".$cod."'");
	$numar = $db->GetNumRows($sql);
	if($numar > 0){
		$sql = $db->Query("SELECT ref FROM `users` WHERE `activate`='".$cod."'");
		$aff = $db->FetchArray($sql);
		if($aff['ref'] > 0){
			$db->Query("UPDATE `users` SET `coins`=`coins`+'".$site['ref_coins']."' WHERE `id`='".$aff['ref']."'");
		}

		$db->Query("UPDATE `users` SET `activate`='0' WHERE `activate`='".$cod."'");
		$mesaj = "<center><b>E-mail address successfully verified!</b></center>";
	}else{
		$mesaj = "<center><b>Incorrect Link!</b></center>";
	}
}else{
	$mesaj = "<center><b>Incorrect Link!</b></center>";
}
echo $mesaj;
print "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=index.php\">";
?>